<!DOCTYPE html>
<html>
<head>
 <meta charset="UTF-8">   
<link rel="stylesheet" href="css/jquery.mobile-1.3.2.min.css">
<script src="http://code.jquery.com/jquery-1.8.3.min.js"></script>
<script src="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.js"></script>


<?php
include_once('../DB.php');
$DB =  new DB();

//获取操作信息
$name=$_GET["name"];
$number = $_GET["number"];
if($name){
    //$res_list = $DB ->get_all("select * from roster where roster_name = {$name}");
      $res_list=$DB->get_all("select A.*,B.class_name
                from roster A left join class B on A.roster_class=B.class_id where  roster_name = {$name}");
                
                echo "aaa".$res_list;
    //可能是别名查询
    if( !$res_list){
          //$res_list = $DB ->get_all("select * from roster where roster_rname = {$name}");
          
             $res_list=$DB->get_all("select A.*,B.class_name
                from roster A left join class B on A.roster_class=B.class_id where  roster_rname = {$name}");
          
          
    }
    
    //echo "<script>alert('操作成功！');</Script>";
}else if($number){
     $res_list=$DB->get_all("select A.*,B.class_name
                from roster A left join class B on A.roster_class=B.class_id where roster_number = {$number}");

}

?>

</head>

<body>
<div data-role="page">
  <div data-role="header">
    <h1>员工信息</h1>
  </div>

  <div data-role="content">
      <?php
      
        foreach($res_list as $value){
            //性别
            $sex;
            //在职情况
            $status;
            
            switch($value[roster_sex]){
                case "1":
                    $sex = "男";
                    break;
                case "2":
                    $sex = "女";
                    break;
            }
            
             switch($value[roster_status]){
                case "0":
                    $status ="试岗期";
                    break;
                case "1":
                    $status = "在职";
                    break;
                case "2":
                    $status = "离职";
                    break;
            }
            
          
        echo 
        "<p>员工信息简介</p></br>
         <p>头像:&nbsp;&nbsp;<img src='{$value[roster_pic]}'width='250px' height='250px'></p></br>
         <p>姓名:&nbsp;&nbsp;$value[roster_name]</p></br>   
         <p>手机:&nbsp;&nbsp;<a href='tel:+{$value[roster_mp]}'>$value[roster_mp]</a></p></br>  
         <p>邮箱:&nbsp;&nbsp;<a href=''>$value[roster_mail]</a></p></br> 
         <p>头衔:&nbsp;&nbsp;$value[roster_title]</p></br>
         <p>工号:&nbsp;&nbsp;$value[roster_number]</p></br>
         <p>性别:&nbsp;&nbsp;$sex</p></br>
         <p>生日:&nbsp;&nbsp;$value[roster_birthday]</p></br>
         <p>在职状态:&nbsp;&nbsp;$status</p></br>
         <p>所在部门:&nbsp;&nbsp;$value[class_name]</p></br>
            ";
      }
  ?>
     
            <div data-role="collapsible">
            <h4>欢迎您来到华视文化</h4>
            <ul data-role="listview">
            </ul>
            </div>
  </div>

  <div data-role="footer">
  <h1>&华视文化员工通讯录</h1>
  </div>
</div> 

</body>
</html>
